package com.linkzd.iot.service.Impl;

import com.linkzd.iot.domain.FloorRoomNumModel;
import com.linkzd.iot.domain.RoomInfo;
import com.linkzd.iot.mapper.RoomInfoMapper;
import com.linkzd.iot.service.IRoomInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RoomInfoServiceImpl implements IRoomInfoService {
    @Autowired
    private RoomInfoMapper roomInfoMapper;
    @Override
    public List<RoomInfo> selectRoomInfoList(RoomInfo roomInfo) {
        return roomInfoMapper.selectRoomInfoList(roomInfo);
    }

    @Override
    public List<FloorRoomNumModel> selectRoomInfoNum() {
        List<FloorRoomNumModel> floorRoomNumModelList = roomInfoMapper.selectRoomInfoNum();
        for (FloorRoomNumModel floorRoomNumModel:floorRoomNumModelList){
            floorRoomNumModel.setName(floorRoomNumModel.getName() + "层");
        }
        return floorRoomNumModelList;
    }

    @Override
    public int insertRoomInfo(RoomInfo roomInfo) {
        return roomInfoMapper.insertRoomInfo(roomInfo);
    }

    @Override
    public int updateRoomInfo(RoomInfo roomInfo) {
        return roomInfoMapper.updateRoomInfo(roomInfo);
    }

    @Override
    public int deleteRoomInfoById(Long id) {
        return roomInfoMapper.deleteRoomInfoById(id);
    }

    @Override
    public RoomInfo selectRoomInfoById(Long roomId) {
        return roomInfoMapper.selectRoomInfoById(roomId);
    }
}
